<template>
	<el-card shadow="never" header="当前已用量">
		<el-row :gutter="15" style="margin-top: 20px;">
			<el-col :lg="6">
				<el-card shadow="never">
					<sc-statistic title="附件文件" :value="fileZs" suffix="份" groupSeparator></sc-statistic>
				</el-card>
			</el-col>
			<el-col :lg="6">
				<el-card shadow="never">
					<sc-statistic title="流程记录" :value="bpmZs" suffix="条" groupSeparator></sc-statistic>
				</el-card>
			</el-col>
			<el-col :lg="6">
				<el-card shadow="never">
					<sc-statistic title="工作日志" :value="diaryZs" suffix="条" groupSeparator></sc-statistic>
				</el-card>
			</el-col>
			<el-col :lg="6">
				<el-card shadow="never">
					<sc-statistic title="邮件数量" :value="emailZs" suffix="封" groupSeparator></sc-statistic>
				</el-card>
			</el-col>
		</el-row>
	</el-card>
</template>

<script>
	import scStatistic from '@/components/scStatistic';

	export default {
		components: {
			scStatistic
		},
		data() {
			return {
				fileZs:0,
				bpmZs:0,
				diaryZs:0,
				emailZs:0
			}
		},
		mounted() {
			this.getMyBpmListTotal();
			this.getMyAttachCount();
			this.getMyDiaryCount();
			this.getMySendEmailCount();
		},
		methods: {
			async getMyBpmListTotal()
			{
				var res = await this.$API.bpm.bpmList.getMyBpmListTotal.get();
				if (res.code == 200) {
					this.bpmZs = res.data.zs;
				} else {
					this.$alert(res.message, "提示", {type: 'error'})
				}
			},
			async getMyAttachCount(){
				var res = await this.$API.file.attach.getMyAttachCount.get();
				if (res.code == 200) {
					this.fileZs = res.data;
				} else {
					this.$alert(res.message, "提示", {type: 'error'})
				}
			},
			async getMyDiaryCount(){
				var res = await this.$API.office.diary.getMyDiaryCount.get();
				if (res.code == 200) {
					this.diaryZs = res.data;
				} else {
					this.$alert(res.message, "提示", {type: 'error'})
				}
			},
			async getMySendEmailCount(){
				var res = await this.$API.email.getMySendEmailCount.get();
				if (res.code == 200) {
					this.emailZs = res.data;
				} else {
					this.$alert(res.message, "提示", {type: 'error'})
				}
			}
		}
	}
</script>

<style>
</style>
